package com.bole.feign;

import com.bole.data.Result;
import com.bole.dto.permission.AdminDto;
import com.bole.fallback.AdminFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "bolecar-backstage-service", fallback = AdminFeignFallback.class)
public interface AdminFeign {
    @GetMapping("/admin")
    Result get();

    @GetMapping("/admin/byName")
    Result getByName(@RequestParam("username") String username);

    @PostMapping("/admin")
    Result add(@RequestParam("rid") Long rid, @RequestBody AdminDto adminDto);

    @GetMapping("/admin/{id}")
    Result getById(@PathVariable("id") Long id);

    @PutMapping("/admin/{id}")
    Result updateById(@PathVariable("id") Long id, @RequestParam("rid") Long rid, AdminDto admin);

    @DeleteMapping("/admin/{id}")
    Result deleteById(@PathVariable("id") Long id);
}
